package com.zoe.spring.controller.superadmin;

import com.zoe.spring.entity.bo.HeadLine;
import com.zoe.spring.entity.bo.ShopCategory;
import com.zoe.spring.entity.dto.Result;
import com.zoe.spring.service.solo.ShopCategoryService;
import org.zoeframework.core.annotation.Controller;
import org.zoeframework.core.inject.annotation.Autowire;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author Zoe.Zhang
 * @date 2022/01/19
 * @description
 */
@Controller
public class ShopCategoryController {
    @Autowire
    private ShopCategoryService shopCategoryService;

    public Result<Boolean> addShopCategory(HttpServletRequest req, HttpServletResponse resp) {
        return shopCategoryService.addShopCategory(new ShopCategory());
    }


    public Result<Boolean> delShopCategory(HttpServletRequest req, HttpServletResponse resp) {
        return shopCategoryService.delShopCategory(1);
    }


    public Result<Boolean> updateShopCategory(HttpServletRequest req, HttpServletResponse resp) {
        return shopCategoryService.updateShopCategory(new ShopCategory());
    }


    public Result<HeadLine> getShopCategoryById(HttpServletRequest req, HttpServletResponse resp) {
        return shopCategoryService.getShopCategoryById(1);
    }


    public Result<List<HeadLine>> listShopCategories(HttpServletRequest req, HttpServletResponse resp) {
        return shopCategoryService.listShopCategories(new ShopCategory(), 1, 5);
    }

}
